using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Article_Comment - 评论表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IArticleComment<T> :ModelBase<ArticleComment> where T : ArticleComment, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.CommentId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return CommentId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.CommentId=dy.CommentId;
           this.UserId=dy.UserId;
           this.UserName=dy.UserName;
           this.ContentId=dy.ContentId;
           this.ConText=dy.ConText;
           this.SubmitTime=dy.SubmitTime;
           this.State=dy.State;
           this.Ip=dy.Ip;
        } 

        #region 定义属性

     
         /// <summary>
        /// 评论id
        /// </summary>
        private String _CommentId = "";
      
        /// <summary>
        /// 评论id
        /// </summary>
        public String CommentId
        {
            get 
            {
              return   (this._CommentId); 
            }

            set 
            {
                    _CommentId= value;  
            }
        }
       
     
         /// <summary>
        /// Userid
        /// </summary>
        private int _UserId =int.MinValue;
      
        /// <summary>
        /// Userid
        /// </summary>
        public int UserId
        {
            get 
            {
              return   (this._UserId); 
            }

            set 
            {
                    _UserId= value;  
            }
        }
       
     
         /// <summary>
        /// 用户昵称
        /// </summary>
        private String _UserName = "";
      
        /// <summary>
        /// 用户昵称
        /// </summary>
        public String UserName
        {
            get 
            {
              return   (this._UserName); 
            }

            set 
            {
                    _UserName= value;  
            }
        }
       
     
         /// <summary>
        /// 所属文章
        /// </summary>
        private int _ContentId =int.MinValue;
      
        /// <summary>
        /// 所属文章
        /// </summary>
        public int ContentId
        {
            get 
            {
              return   (this._ContentId); 
            }

            set 
            {
                    _ContentId= value;  
            }
        }
       
     
         /// <summary>
        /// 评论内容
        /// </summary>
        private String _ConText = "";
      
        /// <summary>
        /// 评论内容
        /// </summary>
        public String ConText
        {
            get 
            {
              return   (this._ConText); 
            }

            set 
            {
                    _ConText= value;  
            }
        }
       
     
         /// <summary>
        /// 评论发布时间
        /// </summary>
        private DateTime _SubmitTime =DateTime.MinValue;
      
        /// <summary>
        /// 评论发布时间
        /// </summary>
        public DateTime SubmitTime
        {
            get 
            {
              return   (this._SubmitTime); 
            }

            set 
            {
                    _SubmitTime= value;  
            }
        }
       
     
         /// <summary>
        /// 状态
        /// </summary>
        private int _State =-1;
      
        /// <summary>
        /// 状态
        /// </summary>
        public yq.Enums.ArticleComment.State State
        {
            get 
            {
              return   (yq.Enums.ArticleComment.State)this._State;  
            }

            set 
            {
                    _State= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// IP
        /// </summary>
        private String _Ip = "";
      
        /// <summary>
        /// IP
        /// </summary>
        public String Ip
        {
            get 
            {
              return   (this._Ip); 
            }

            set 
            {
                    _Ip= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(ArticleComment info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["CommentId"]!= DBNull.Value)
                  {
                  info.CommentId=row["CommentId"].ToString();
                 }
                 
                  
                  if(row["UserId"]!= DBNull.Value)
                  {
                  info.UserId=Convert.ToInt32(row["UserId"]);
                 }
                 
                  
                  if(row["UserName"]!= DBNull.Value)
                  {
                  info.UserName=row["UserName"].ToString();
                 }
                 
                  
                  if(row["ContentId"]!= DBNull.Value)
                  {
                  info.ContentId=Convert.ToInt32(row["ContentId"]);
                 }
                 
                  
                  if(row["ConText"]!= DBNull.Value)
                  {
                  info.ConText=row["ConText"].ToString();
                 }
                 
                  
                  if(row["SubmitTime"]!= DBNull.Value)
                  {
                  info.SubmitTime=Convert.ToDateTime(row["SubmitTime"]);
                 }
                 
                  
                  if(row["State"]!= DBNull.Value)
                  {
                  info.State=  (yq.Enums.ArticleComment.State)(row["State"]) ;
                 }
                 
                  
                  if(row["Ip"]!= DBNull.Value)
                  {
                  info.Ip=row["Ip"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, ArticleComment info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@CommentId", DbType.String,ParameterTool.GetObj( info._CommentId )); 
            
             
                cn.AddInParameter(comm, "@UserId", DbType.Int32,ParameterTool.GetObj( info._UserId )); 
            
             
                cn.AddInParameter(comm, "@UserName", DbType.String,ParameterTool.GetObj( info._UserName )); 
            
             
                cn.AddInParameter(comm, "@ContentId", DbType.Int32,ParameterTool.GetObj( info._ContentId )); 
            
             
                cn.AddInParameter(comm, "@ConText", DbType.String,ParameterTool.GetObj( info._ConText )); 
            
             
                cn.AddInParameter(comm, "@SubmitTime", DbType.DateTime,ParameterTool.GetObj( info._SubmitTime )); 
            
             
                cn.AddInParameter(comm, "@State", DbType.Int32,ParameterTool.GetObj( info._State )); 
            
             
                cn.AddInParameter(comm, "@Ip", DbType.String,ParameterTool.GetObj( info._Ip )); 
            
        } 

    } 
} 